package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.entity.TbShift;
import com.lrkj.back.service.TbShiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lrkj.back.mapper.TbShiftMapper;
import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("ShiftService")
public class TbShiftServiceImpl extends ParentServiceImpl<TbShift> implements TbShiftService {

    @Autowired
    private TbShiftMapper shiftMap;

    @Override
    public PageInfo<TbShift> findAllTbShift(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<TbShift> tbList = shiftMap.findAllTbShift(map);
        PageInfo<TbShift> page = new PageInfo<TbShift>(tbList);
        return page;

    }

    @Override
    protected DBInterface<TbShift> getDao() throws DBException {
        return shiftMap;
    }

    @Override
    public List<TbShift> findAll(Map<String, Object> map) throws DBException {
        return shiftMap.findAllTbShift(map);
    }

    @Override
    public int deleteByBatch(List<String> ids) throws DBException {
        return shiftMap.deleteByBatch(ids);
    }

    @Override
    public int deleteByfiles(List<String> files) throws DBException {
        return shiftMap.deleteByfiles(files);
    }

    @Override
    public TbShift findOne(Map<String, Object> map) {
        return shiftMap.findOne(map);
    }
}
